package ch04;

import java.util.Arrays;

/**
 * @author yang
 * @date 2024-04-02
 */
public class TestMain {
    public static void main(String[] args) {
        // 初始化数组
        MyArrayList<String> list = new MyArrayList<>();
        // 添加参数
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        System.out.println(Arrays.toString(list.getElementData()));

        // 根据下标查询参数
        System.out.println("list.get(1) = "+list.get(1));

        // 根据下标覆盖数据（返回原数据）
        String ddd = list.set(1, "DDD");
        System.out.println("list.set(1, DDD) = "+ddd);
        System.out.println("newValue = "+list.get(1));

        // 移除数据
        String remove = list.remove(1);
        System.out.println("list.remove(1) = "+remove);
        System.out.println("newList = "+Arrays.toString(list.getElementData()));
    }
}
